type binop =
    Plus
  | Minus
  | Times
  | Div
  | Mod
  | Le
  | Leq
  | Ge
  | Geq
  | Eq
  | Neq
  | And
  | Or

type uop = Uminus | Neg

type mptype = Integer | Boolean | Void | Record of string | Pointer

type expr =
    T
  | F
  | Int of int
  | Var of string
  | Binexpr of binop * expr * expr
  | Unexpr of uop * expr
  | Call of string * expr list
  | Field of string * expr * string
  | Nil of mptype

type stat =
    Assign of expr * expr
  | If1 of expr * stat
  | If2 of expr * stat * stat
  | While of expr * stat
  | Seq of stat list
  | Expr of expr
  | New of expr * mptype


type typing = string * mptype

type mpsort = mptype list * mptype

type sorting = string * mpsort

type sortings = sorting list

type decl = typing list

class type mprecord_t =
object
	method name : string
	method members : decl	
end

val new_mprecord : string -> decl -> mprecord_t

class type mpfun_t =
object
  method name : string
  method parms : decl
  method locals : decl
  method body : stat
  method rettype : mptype
  method print : unit
end

val new_mpfun : string -> decl -> decl -> stat -> mptype -> mpfun_t

class type mpprog_t =
object
  method vars : decl
	method recorddecls : mprecord_t list
  method fundecls : sortings
  method funs : mpfun_t list
  method body : stat
  method print : unit
end

val new_mpprog : decl -> mprecord_t list -> sortings -> mpfun_t list -> stat -> mpprog_t

val print_type : mptype -> unit
